import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/m',
    name: 'mobile',
    component: () => import('../views/Mobile'),
    children: [
      // /m         Home
      // /m/user    User
      // /m/about   About
      {
        path: "",
        name: "mobile-home",
        component: () => import("../views/mobile/Home")
      },
      {
        path: "user",
        name: "mobile-user",
        component: () => import("../views/mobile/User")
      },
      {
        path: "user/:user_id",
        name: "mobile-user-detail",
        component: () => import("../views/mobile/UserDetail")
      },
      {
        path: "about",
        name: "mobile-about",
        component: () => import("../views/mobile/About")
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
